package com.liuda.workbench.service.impl;

import com.liuda.workbench.domain.Activity;
import com.liuda.workbench.domain.Count;
import com.liuda.workbench.mapper.ActivityMapper;
import com.liuda.workbench.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ActivityServiceImpl implements ActivityService {
    @Autowired
    ActivityMapper activityMapper;
    @Override
    public int createActivity(Activity activity) {
        return activityMapper.insert(activity);
    }

    @Override
    public List<Activity> queryActivityByCondition(Map map) {
       return activityMapper.selectByCondition(map);
    }

    @Override
    public int queryCountOfActivityByCondition(Map map) {
        return activityMapper.queryCountByCondition(map);
    }

    @Override
    public int deleteByIds(String[] ids) {
        return activityMapper.deleteByIds(ids);
    }

    @Override
    public Activity queryActivityById(String id) {
        return activityMapper.queryActivityById(id);
    }

    @Override
    public int updateById(Activity activity) {
        return activityMapper.updateByPrimaryKey(activity);
    }

    public List<Activity> selectAll(){
        return activityMapper.selectAll();
    }

    @Override
    public List<Activity> selectByClueIdForDetail(String clueId) {
        return activityMapper.selectByClueIdForDetail(clueId);
    }

    @Override
    public List<Activity> selectByIds(String[] ids) {
        return activityMapper.selectByIds(ids);
    }

    @Override
    public List<Activity> selectByIdsForDetail(String[] ids) {
        return activityMapper.selectByIdsForDetail(ids);
    }

    @Override
    public int insertActivities(List<Activity> activityList) {
        return activityMapper.insertActivities(activityList);
    }

    @Override
    public Activity queryActivityDetailById(String id) {
        return activityMapper.queryActivityDetailById(id);
    }

    @Override
    public List<Activity> queryActivityByClueId(String clueId) {
        return activityMapper.queryActivityByClueId(clueId);
    }

    @Override
    public List<Activity> queryActivityNotInClueId(String clueId) {
        return activityMapper.queryActivityNotInClueId(clueId);
    }

    @Override
    public List<Activity> queryActivityByLikeAndClueId(String name,String clueId) {
        return  activityMapper.queryActivityByLikeAndClueId(name,clueId);
    }

    @Override
    public List<Activity> queryActivityByLikeAndNotInClueId(String name, String clueId) {
        return activityMapper.queryActivityByLikeAndNotInClueId(name,clueId);
    }

    @Override
    public List<Activity> selectByLikeForDetail(String name) {
        return activityMapper.selectByLikeForDetail(name);
    }

    @Override
    public List<Activity> selectByContactsId(String contactsId) {
        return activityMapper.selectByContactsId(contactsId);
    }

    @Override
    public List<Count> getActivityCountByOwner() {
        return activityMapper.getActivityCountByOwner();
    }
}
